--参考来源https://www.bilibili.com/video/BV1m4bveVEaN/
--以下为自用部分，大家随便用
local flag1 = false
function SmoothMouseMovement(x_speed, y_speed, duration)
    local last_x, last_y = 0, 0
    local tm_start = GetRunningTime()
    repeat
        Sleep(5)
        local tm = math.min(GetRunningTime() - tm_start, duration)
        local x = math.floor(x_speed * tm)
        local y = math.floor(y_speed * tm)
        if x ~= last_x or y ~= last_y then
            MoveMouseRelative(x - last_x, y - last_y)
            last_x = x
            last_y = y
        end
    until tm >= duration
end

function OnEvent(event, arg)
    --自动奔跑
    if IsMouseButtonPressed(4) then
        if not flag1 then
            PressKey("w")
            flag1 = true
        else
            ReleaseKey("w")
            flag1 = false
        end
    end

    --单按鼠标按键5开始转圈，这里的2.6适配1600*900分辨率，1080P分辨率换成6
    if (event == "MOUSE_BUTTON_PRESSED" and arg ==5) then 
      PressAndReleaseKey("e")
      Sleep(5)
      SmoothMouseMovement(2.6,0,480)
      MoveMouseRelative(0,-80)
      SmoothMouseMovement(2.6,0,480)
      MoveMouseRelative(0,80)
    end  
end